home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
- ########################################################################################
-
-
- # Make Clicker disconnect gracefully so as not to confuse the Bluetooth stack (we're also
- # trying the old dictionary style for disconnecting
- my $CLICKER_IS_RUNNING = 0;
- open(PSOUT, "/bin/ps -awwx |");
- while( <PSOUT> ) {
- if( /SEC\ Helper\.app/ ) {
- $CLICKER_IS_RUNNING = 1;
- }
- }
- close(PSOUT);
- if(1 eq $CLICKER_IS_RUNNING) {
- print "Telling SEC Helper to \"remove accessory menu\" with timeout of 10 seconds\n";
- system("/usr/bin/osascript -e \'with timeout of 10 seconds\' -e \'tell application \"SEC Helper\"\' -e \'remove accessory menu\' -e \'end tell\' -e \'end timeout\' 2> /dev/null");
- print "Telling SEC Helper to \"remove menu\" with timeout of 10s\n";
- system("/usr/bin/osascript -e \'with timeout of 10 seconds\' -e \'tell application \"SEC Helper\"\' -e \'remove menu\' -e \'end tell\' -e \'end timeout\' 2> /dev/null");
- sleep(2);
- }
-
-
- # Quit Clicker (we're also trying to killing the very first Clicker background app)
- open(PSOUT, "/bin/ps -awwx |");
- while( <PSOUT> ) {
- if( /\s*(\d+)\s+.+SEC\ Helper\.app/ ) {
- print "Killing SEC Helper with PID = $1\n";
- kill 9, $1;
- }
- }
- close(PSOUT);
-
- open(PSOUT, "/bin/ps -awwx |");
- while( <PSOUT> ) {
- if( /\s*(\d+)\s+.+ Sony\ Ericsson\ Clicker\ Helper\.app/ ) {
- print "Killing Sony Ericsson Clicker Helper with PID = $1\n";
- kill 9, $1;
- }
- }
- close(PSOUT);
-
- # Move the very old type of distribution out of the way, as Installer can't find it
- my $TEMP_DIR = $ARGV[2] . "/private/tmp/tyuauehp7/";
- my $RECYCLYING = $TEMP_DIR . "/OldSallingClicker/";
- mkdir $TEMP_DIR;
- mkdir $RECYCLYING;
- # Make sure the old helper application can't be started, as LaunchServices might choose it
- # over the new version otherwise. Could have used "rm", but this is safer:
- system("/bin/mv \"$ARGV[2]/Library/PreferencePanes/Sony Ericsson Clicker.prefPane\" \"$RECYCLYING\"");
- system("/bin/chmod a-x \"$RECYCLYING/Sony Ericsson Clicker.prefPane/Contents/MacOS/SEC Helper.app/Contents/MacOS/SEC Helper\"");
-
- ########################################################################################
-
- exit(0);
-